﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using MyTask.Tasking.Domain.TaskAggregate;
using System;
using System.Collections.Generic;
using System.Text;

namespace MyTask.Tasking.Infrastructure.EntityConfigurations
{
    public class UserInfoEntityTypeConfiguration : IEntityTypeConfiguration<UserInfo>
    {
        public void Configure(EntityTypeBuilder<UserInfo> builder)
        {
            builder.HasKey(p => p.Id);
            builder.ToTable("user_info");
            builder.Property(p => p.FirstName).HasMaxLength(20);
            builder.Property(p => p.LastName).HasMaxLength(20);
            builder.Property(p => p.UserName).HasMaxLength(30);
            builder.Property(p => p.Password).HasMaxLength(20);
            builder.Property(p => p.CreateTime);
            var navigation = builder.Metadata.FindNavigation(nameof(UserInfo.TaskList));
            navigation.SetPropertyAccessMode(PropertyAccessMode.Field);
        }
    }
}
